import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login/index.vue'
import Layout from '../views/layout.vue'
import RouterView from '../components/RouterView/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/pdf/:pdf?',
    name: 'pdf',
    component: () => import('@/views/pdf/pdf.vue'),
    meta: { requiresAuth: true }
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
    hidden: true,
    meta: { requiresAuth: false }
  },
  {
    path: '/tologin',
    name: 'tologin',
    component: () => import('@/views/login.vue'),
    hidden: true,
    meta: { requiresAuth: false }
  },
  {
    path: '/',
    name: 'Login',
    component: Login,
    hidden: true,
    meta: { requiresAuth: false }
  },
  {
    path: '/BigData',
    name: 'BigData',
    component: () => import('@/views/BigData/index'),
    hidden: true,
    meta: { requiresAuth: true }
  }

  ,
  {
    path: "/",
    name: "Layout",
    component: Layout,
    children: [
      {
        path: '/project',
        name: 'project',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '项目基础信息管理'
        },
        children: [
          {
            path: '/project/Project',
            name: 'Project',
            component: () => import('@/views/SystemAdmin/Project/index'),
            hidden: true,
            meta: { title: '项目管理', requiresAuth: true, }
          },
          {
            path: '/project/TunnelInfo',
            name: 'TunnelInfo',
            component: () => import('@/views/ProjectAdmin/TunnelInfo/index'),
            hidden: true,
            meta: { title: '隧道管理', requiresAuth: true }
          },
          {
            path: '/project/direction',
            name: 'direction',
            component: () => import('@/views/SystemAdmin/direction/index'),
            hidden: true,
            meta: { title: '方向管理', requiresAuth: true }
          },
          {
            path: '/project/section',
            name: 'section',
            component: () => import('@/views/SystemAdmin/section/index.vue'),
            hidden: true,
            meta: { title: '断面管理', requiresAuth: true }
          }
          ,
          {
            path: '/project/tunnelwidth',
            name: 'tunnelwidth',
            component: () => import('@/views/SystemAdmin/width/index.vue'),
            hidden: true,
            meta: { title: '洞幅管理', requiresAuth: true }
          } ,
          {
            path: '/project/Progress',
            name: 'Progress',
            component: () => import('@/views/SystemAdmin/Progress/index.vue'),
            hidden: true,
            meta: { title: '施工进度', requiresAuth: true }
          }
        ]
      },
      {
        path: '/design',
        name: 'design',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '隧道设计信息'
        },
        children: [
          {
            path: '/design/addrPlane',
            name: 'AddrPlane',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/AddrPlane/index.vue'),
            hidden: true,
            meta: { title: '设计图纸', requiresAuth: true }
          },
          // 纵断面
          {
            path: '/design/vertical',
            name: 'vertical',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/vertical/index.vue'),
            hidden: true,
            meta: { title: '纵断面图', requiresAuth: true }
          },
          // 超前支护
          {
            path: '/design/drawSupport',
            name: 'drawSupport',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/drawSupport/index.vue'),
            hidden: true,
            meta: { title: '超前支护', requiresAuth: true }
          },
          // 施工方案
          {
            path: '/design/build',
            name: 'build',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/build/index.vue'),
            hidden: true,
            meta: { title: '施工方案', requiresAuth: true }
          },
          {
            path: '/design/lining',
            name: 'lining',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/lining/index.vue'),
            hidden: true,
            meta: { title: '衬砌设计', requiresAuth: true }
          },
          // 监控量测
          {
            path: '/design/monitoring',
            name: 'monitoring',
            component: () => import('@/views/ProjectAdmin/TunnelDesign/monitoring/index.vue'),
            hidden: true,
            meta: { title: '监测方案', requiresAuth: true }
          }
        ]
      },
      {
        path: '/unit',
        name: 'unit',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '工作监督管理'
        },
        children: [
          {
            path: '/unit/ConstructionUnit',
            name: 'ConstructionUnit',
            component: () => import('@/views/Construction/ConstructionUnit/index.vue'),
            hidden: true,
            meta: { title: '建设单位管理', requiresAuth: true }
          }]
      }
      ,
      {
        path: '/system',
        name: 'system',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '系统信息管理'
        },
        children: [
          {
            path: '/system/etype',
            name: 'etype',
            component: () => import('@/views/SystemAdmin/Etype/index.vue'),
            hidden: true,
            meta: { title: '开挖方式', requiresAuth: true }
          },
          {
            path: '/system/personAdmin',
            name: 'PersonAdmin',
            component: () => import('@/views/SystemAdmin/Person/index'),
            hidden: true,
            meta: { title: '人员管理', requiresAuth: true }
          },
          {
            path: '/system/syswarnlog',
            name: 'syswarnlog',
            component: () => import('@/views/SystemAdmin/WarnLog/index'),
            hidden: true,
            meta: { title: '预警日志', requiresAuth: true }
          },
          {
            path: '/system/personal',
            name: 'personal',
            component: () => import('@/views/profile/index'),
            hidden: true,
            meta: { title: '个人中心', requiresAuth: true }
          }
        ]
      },
      {
        path: '/construction',
        name: 'construction',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '施工质量量测'
        },
        children: [
          {
            path: '/construction/quailtyAdmin',
            name: 'QuailtyAdmin',
            component: () => import('@/views/ConstructionQuality/QuailtyAdmin/index'),
            hidden: true,
            meta: { title: '初支检测', requiresAuth: true }
          },
          {
            path: '/construction/erchen',
            name: 'erchen',
            component: () => import('@/views/ConstructionQuality/erchen/index.vue'),
            hidden: true,
            meta: { title: '二衬检测', requiresAuth: true }
          }
        ]
      },
      {
        path: '/geology',
        name: 'geology',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '超前地质预报'
        },
        children: [
          {
            path: '/geology/predictionInfo',
            name: 'predictionInfo',
            component: () => import('@/views/Prediction/PredictionInfo/index'),
            hidden: true,
            meta: { title: '超前地质预报', requiresAuth: true }
          }
        ]
      },
      {
        path: '/monitor',
        name: 'monitor',
        component: RouterView,
        meta: {
          requiresAuth: true, title: '施工监控量测'
        },
        children: [
          {
            path: '/monitor/monitorInfo',
            name: 'monitorInfo',
            component: () => import('@/views/ConstructionMonitor/MonitorInfo/index'),
            hidden: true,
            meta: { title: '拱顶下沉', requiresAuth: true }
          },
          {
            path: '/monitor/monitorfoot',
            name: 'monitorfoot',
            component: () => import('@/views/ConstructionMonitor/MonitorFoot/index'),
            hidden: true,
            meta: { title: '拱脚下沉', requiresAuth: true }
          },
          {
            path: '/monitor/monitorperiphery',
            name: 'monitorperiphery',
            component: () => import('@/views/ConstructionMonitor/MonitorPeriphery/index'),
            hidden: true,
            meta: { title: '周边位移', requiresAuth: true }
          },
          {
            path: '/monitor/monitorsuface',
            name: 'monitorsuface',
            component: () => import('@/views/ConstructionMonitor/MonitorSurface/index'),
            hidden: true,
            meta: { title: '地表下沉', requiresAuth: true }
          },
          {
            path: '/monitor/MonitorReport',
            name: 'MonitorReport',
            component: () => import('@/views/ConstructionMonitor/MonitorReport/index'),
            hidden: true,
            meta: { title: '报告管理', requiresAuth: true }
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
